﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SF.Base.Core;

namespace SF.Dict.Web.UserControls {
	public partial class ucVocAside : BaseControl {

		/// <summary>
		/// 词汇表数字ID
		/// </summary>
		public string VocabularyId {
			get;
			set;
		}

		protected long Vid{
			get;
			set;
		}

		protected void Page_Load(object sender, EventArgs e) {

			VocabularyEntity voc = VocabularyRules.GetVocabulary(VocabularyId);
			Vid = voc.Vid;
			//查询词汇表的创始人资料
			UserEntity initiator = UserRules.GetUserByUserId(voc.UserId);
			if (initiator != null) {
				ltl_initiator.Text = string.Format(ltl_initiator.Text, initiator.UID, initiator.UserMeta["Avatar"], initiator.NiceName, initiator.UserMeta["station"]);
			}
			else{
				ltl_initiator.Text = "";
			}

			//查询关注此词汇表的人
			List<UserEntity> lists = VocabularyRules.GetFollowUserByVocabularyid(voc.VocabularyId);
			if (lists.Count == 0) {
				ph_follows.Visible = false;
			}
			else{
				rp_follows.DataSource = lists;
				rp_follows.DataBind();
			}

		}
	}
}